{extend name="base/common"}

{block name="style"}
<link rel="stylesheet" href="__STATIC__/datepicker/bootstrap-datetimepicker.min.css">
<link rel="stylesheet" href="__STATIC__/iCheck/custom.css">
<link rel="stylesheet" href="__ADMIN__/css/chosen/chosen.css">
{/block}

{block name="page-header"}
<div class="row wrapper border-bottom white-bg page-heading">
    <div class="col-lg-10">
        <h2>课表管理</h2>
        <ol class="breadcrumb">
            <li>
                <a href="{:Url('Course/index')}">首页</a>
            </li>
            <li class="active">
                <strong>{empty name="msg"}新增{else/}修改{/empty}</strong>
            </li>
        </ol>
    </div>
    <div class="col-lg-2">

    </div>
</div>
{/block}

{block name="main"}
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    {eq name="$is" value="1"}
                    <h5 style="color: red">* 该课表已分配学员，暂无法修改，若做修改请先删除再重新添加！</h5>
                    {else/}
                    <h5></h5>
                    {/eq}
                    <div class="ibox-tools">
                        <a href="javascript:window.history.go(-1);" class="btn btn-white btn-sm"><i class="fa fa-reply"></i> 返回</a>
                    </div>
                </div>
                <div class="ibox-content all">
                    <form id="form" class="form-horizontal" method="post">
                        {notempty name="msg"}
                        <div class="form-group">
                            <div class="col-lg-1 text-right control-label">
                                <label>课表编码:</label>
                            </div>
                            <div class="col-lg-11">
                                <input type="text" style="color: green;font-weight: bolder;font-size: 20px" class="form-control form_title" value="{$msg.order || default='暂无'}" disabled>
                            </div>
                        </div>
                        {/notempty}
                        <div class="form-group">
                            <div class="col-lg-1 text-right control-label">
                                <label>国家:</label>
                            </div>
                            <div class="col-lg-11">
                                <select name="country" id="type"  class="form-control country" >
                                    {empty name="msg"}
                                    {volist name="country" id="cc"}
                                    <option value="{$cc.num}" {eq name="$cc.num" value="156"} selected {/eq}>{$cc.name || default='暂无'}</option>
                                    {/volist}
                                    {else/}
                                    {volist name="country" id="gg"}
                                    <option value="{$gg.num}" {eq name="$msg.country_id" value="$gg.num"} selected {/eq}>{$gg.name || default='暂无'}</option>
                                    {/volist}
                                    {/empty}
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-lg-1 text-right control-label">
                                <label>省份:</label>
                            </div>
                            <div class="col-lg-11">
                                <select name="city" id="type"  class="form-control city" >
                                    {empty name="msg"}
                                    {volist name="city" id="cc"}
                                    <option value="{$cc.num}" {eq name="$cc.num" value="33"} selected {/eq}>{$cc.province || default='暂无'}</option>
                                    {/volist}
                                    {else/}
                                    {volist name="city" id="gg"}
                                    <option value="{$gg.num}" {eq name="$msg.city_id" value="$gg.num"} selected {/eq}>{$gg.province || default='暂无'}</option>
                                    {/volist}
                                    {/empty}
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-lg-1 text-right control-label">
                                <label>分校:</label>
                            </div>
                            <div class="col-lg-11">
                                <select name="place" id="type"  class="form-control place" >
                                    {empty name="msg"}
                                    {volist name="place" id="cc"}
                                    <option value="{$cc.num}" {eq name="$cc.num" value="00"} selected {/eq}>{$cc.name || default='暂无'}</option>
                                    {/volist}
                                    {else/}
                                    {volist name="place" id="gg"}
                                    <option value="{$gg.num}" {eq name="$msg.place_id" value="$gg.num"} selected {/eq}>{$gg.name || default='暂无'}</option>
                                    {/volist}
                                    {/empty}
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-lg-1 text-right control-label">
                                <label>学历:</label>
                            </div>
                            <div class="col-lg-11">
                                <select name="education" id="type"  class="form-control education" >
                                    {empty name="msg"}
                                    {volist name="education" id="cc"}
                                    <option value="{$cc.num}" {eq name="$cc.num" value="20"} selected {/eq}>{$cc.name || default='暂无'}</option>
                                    {/volist}
                                    {else/}
                                    {volist name="education" id="gg"}
                                    <option value="{$gg.num}" {eq name="$msg.education_id" value="$gg.num"} selected {/eq}>{$gg.name || default='暂无'}</option>
                                    {/volist}
                                    {/empty}
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-lg-1 text-right control-label">
                                <label>课程名称:</label>
                            </div>
                            <div class="col-lg-11">
                                <select name="name" id="type"  class="form-control name" >
                                    {empty name="msg"}
                                    {volist name="name" id="gg"}
                                    <option value="{$gg.num}" {eq name="$gg.num" value="01"} selected {/eq}>{$gg.name || default='暂无'}</option>
                                    {/volist}
                                    {else/}
                                    {volist name="name" id="gg"}
                                    <option value="{$gg.num}" {eq name="$msg.name_id" value="$gg.num"} selected {/eq}>{$gg.name}</option>
                                    {/volist}
                                    {/empty}
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-lg-1 text-right control-label">
                                <label>项目:</label>
                            </div>
                            <div class="col-lg-11">
                                <select name="project" id="type"  class="form-control project" >
                                    {empty name="msg"}
                                    {volist name="gate" id="gg"}
                                    <option value="{$gg.num}">{$gg.xm_name || default='暂无'}——{$gg.zxm_name || default='暂无'}</option>
                                    {/volist}
                                    {else/}
                                    {volist name="gate" id="gg"}
                                    <option value="{$gg.num}" {eq name="$msg.project_id" value="$gg.num"} selected {/eq}>{$gg.xm_name || default='暂无'}——{$gg.zxm_name || default='暂无'}</option>
                                    {/volist}
                                    {/empty}
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-lg-1 text-right control-label">
                                <label>科目:</label>
                            </div>
                            <div class="col-lg-11">
                                <select name="subject" id="type"  class="form-control subject" >
                                    {empty name="msg"}
                                    {volist name="subject" id="gg"}
                                    <option  value="{$gg.num}">{$gg.zxm_name || default='暂无'}——{$gg.kemu || default='暂无'}</option>
                                    {/volist}
                                    {else/}
                                    {volist name="subject" id="gg"}
                                    <option  value="{$gg.num}" {eq name="$msg.subject_id" value="$gg.num"} selected {/eq} >{$gg.zxm_name || default='暂无'}——{$gg.kemu || default='暂无'}</option>
                                    {/volist}
                                    {/empty}
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-lg-1 text-right control-label">
                                <label>辅导阶段:</label>
                            </div>
                            <div class="col-lg-11">
                                <select name="stage" id="type"  class="form-control stage" >
                                    {empty name="msg"}
                                    {volist name="stage" id="gg"}
                                    <option value="{$gg.num}" {eq name="$gg.num" value="01"} selected {/eq}>{$gg.name || default='暂无'}</option>
                                    {/volist}
                                    {else/}
                                    {volist name="stage" id="gg"}
                                    <option value="{$gg.num}" {eq name="$msg.stage_id" value="$gg.num"} selected {/eq}>{$gg.name || default='暂无'}</option>
                                    {/volist}
                                    {/empty}
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-lg-1 text-right control-label">
                                <label>模块:</label>
                            </div>
                            <div class="col-lg-11">
                                <select name="module" id="type"  class="form-control module" >
                                    {empty name="msg"}
                                    {volist name="module" id="gg"}
                                    <option value="{$gg.num}" {eq name="$gg.num" value="0000"} selected {/eq}>{$gg.kemu || default='暂无'}——{$gg.mokuai || default='暂无'}</option>
                                    {/volist}
                                    {else/}
                                    {volist name="module" id="gg"}
                                    <option value="{$gg.num}" {eq name="$msg.module_id" value="$gg.num"} selected {/eq}>{$gg.kemu || default='暂无'}——{$gg.mokuai || default='暂无'}</option>
                                    {/volist}
                                    {/empty}
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-lg-1 text-right control-label">
                                <label>课次:</label>
                            </div>
                            <div class="col-lg-11">
                                <select name="time" id="type"  class="form-control time" >
                                    {empty name="msg"}
                                    <option value="01">第一次</option><option value="02">第二次</option><option value="03">第三次</option><option value="04">第四次</option><option value="05">第五次</option><option value="06">第六次</option><option value="07">第七次</option><option value="08">第八次</option><option value="09">第九次</option><option value="10">第十次</option><option value="11">第十一次</option><option value="12">第十二次</option><option value="13">第十三次</option><option value="14">第十四次</option><option value="15">第十五次</option><option value="16">第十六次</option><option value="17">第十七次</option><option value="18">第十八次</option><option value="19">第十九次</option><option value="20">第二十次</option><option value="21">第二十一次</option><option value="22">第二十二次</option><option value="23">第二十三次</option><option value="24">第二十四次</option><option value="25">第二十五次</option><option value="26">第二十六次</option><option value="27">第二十七次</option><option value="28">第二十八次</option><option value="29">第二十九次</option><option value="30">第三十次</option><option value="31">第三十一次</option><option value="32">第三十二次</option><option value="33">第三十三次</option><option value="34">第三十四次</option><option value="35">第三十五次</option><option value="36">第三十六次</option><option value="37">第三十七次</option><option value="38">第三十八次</option><option value="39">第三十九次</option><option value="40">第四十次</option><option value="41">第四十一次</option><option value="42">第四十二次</option><option value="43">第四十三次</option><option value="44">第四十四次</option><option value="45">第四十五次</option><option value="46">第四十六次</option><option value="47">第四十七次</option><option value="48">第四十八次</option><option value="49">第四十九次</option><option value="50">第五十次</option>
                                    {else/}
                                    <option value="01" {eq name="$msg.time" value="01"} selected {/eq} >第一次</option><option value="02" {eq name="$msg.time" value="02"} selected {/eq}>第二次</option><option value="03" {eq name="$msg.time" value="03"} selected {/eq}>第三次</option><option value="04" {eq name="$msg.time" value="04"} selected {/eq}>第四次</option><option value="05" {eq name="$msg.time" value="05"} selected {/eq}>第五次</option><option value="06" {eq name="$msg.time" value="06"} selected {/eq}>第六次</option><option value="07" {eq name="$msg.time" value="07"} selected {/eq}>第七次</option><option value="08" {eq name="$msg.time" value="08"} selected {/eq}>第八次</option><option value="09" {eq name="$msg.time" value="09"} selected {/eq}>第九次</option><option value="10" {eq name="$msg.time" value="10"} selected {/eq}>第十次</option><option value="11" {eq name="$msg.time" value="11"} selected {/eq}>第十一次</option><option value="12" {eq name="$msg.time" value="12"} selected {/eq}>第十二次</option><option value="13" {eq name="$msg.time" value="13"} selected {/eq}>第十三次</option><option value="14" {eq name="$msg.time" value="14"} selected {/eq}>第十四次</option><option value="15" {eq name="$msg.time" value="15"} selected {/eq}>第十五次</option><option value="16" {eq name="$msg.time" value="16"} selected {/eq}>第十六次</option><option value="17" {eq name="$msg.time" value="17"} selected {/eq}>第十七次</option><option value="18" {eq name="$msg.time" value="18"} selected {/eq}>第十八次</option><option value="19" {eq name="$msg.time" value="19"} selected {/eq}>第十九次</option><option value="20" {eq name="$msg.time" value="20"} selected {/eq}>第二十次</option><option value="21" {eq name="$msg.time" value="21"} selected {/eq} >第二十一次</option><option value="22" {eq name="$msg.time" value="22"} selected {/eq} >第二十二次</option><option value="23" {eq name="$msg.time" value="23"} selected {/eq} >第二十三次</option><option value="24"  {eq name="$msg.time" value="24"} selected {/eq}>第二十四次</option><option value="25" {eq name="$msg.time" value="25"} selected {/eq} >第二十五次</option><option value="26" {eq name="$msg.time" value="26"} selected {/eq} >第二十六次</option><option value="27" {eq name="$msg.time" value="27"} selected {/eq} >第二十七次</option><option value="28" {eq name="$msg.time" value="28"} selected {/eq} >第二十八次</option><option value="29"  {eq name="$msg.time" value="29"} selected {/eq}>第二十九次</option><option value="30" {eq name="$msg.time" value="30"} selected {/eq} >第三十次</option><option value="31" {eq name="$msg.time" value="31"} selected {/eq} >第三十一次</option><option value="32" {eq name="$msg.time" value="32"} selected {/eq} >第三十二次</option><option value="33" {eq name="$msg.time" value="33"} selected {/eq} >第三十三次</option><option value="34" {eq name="$msg.time" value="34"} selected {/eq} >第三十四次</option><option value="35"  {eq name="$msg.time" value="35"} selected {/eq}>第三十五次</option><option value="36" {eq name="$msg.time" value="36"} selected {/eq} >第三十六次</option><option value="37" {eq name="$msg.time" value="37"} selected {/eq} >第三十七次</option><option value="38" {eq name="$msg.time" value="38"} selected {/eq} >第三十八次</option><option value="39" {eq name="$msg.time" value="39"} selected {/eq} >第三十九次</option><option value="40"  {eq name="$msg.time" value="40"} selected {/eq}>第四十次</option><option value="41" {eq name="$msg.time" value="41"} selected {/eq} >第四十一次</option><option value="42" {eq name="$msg.time" value="42"} selected {/eq} >第四十二次</option><option value="43" {eq name="$msg.time" value="43"} selected {/eq} >第四十三次</option><option value="44" {eq name="$msg.time" value="44"} selected {/eq} >第四十四次</option><option value="45" {eq name="$msg.time" value="45"} selected {/eq} >第四十五次</option><option value="46"  {eq name="$msg.time" value="46"} selected {/eq} >第四十六次</option><option value="47" {eq name="$msg.time" value="47"} selected {/eq} >第四十七次</option><option value="48" {eq name="$msg.time" value="48"} selected {/eq} >第四十八次</option><option value="49" {eq name="$msg.time" value="49"} selected {/eq} >第四十九次</option><option value="50" {eq name="$msg.time" value="50"} selected {/eq} >第五十次</option>
                                    {/empty}
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-lg-1 text-right control-label">
                                <label>班型:</label>
                            </div>
                            <div class="col-lg-11">
                                <select name="class" id="type"   class="form-control class" >
                                    {empty name="msg"}
                                    <option value="0" >--请选择班型--</option>
                                    {volist name="class" id="gg"}
                                    <option value="{$gg.id}">{$gg.banxing || default='暂无'}</option>
                                    {/volist}
                                    {else/}
                                    <option value="0" >--请选择班型--</option>
                                    {volist name="class" id="gg"}
                                    <option value="{$gg.id}" {eq name="$msg.class" value="$gg.id"} selected {/eq}>{$gg.banxing || default='暂无'}</option>
                                    {/volist}
                                    {/empty}
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-lg-1 text-right control-label">
                                <label>授课老师:</label>
                            </div>
                            <div class="col-lg-11">
                                <select name="teacher" id="type"  class="form-control teacher" >
                                    {empty name="msg"}
                                    {volist name="teacher" id="gg"}
                                    <option value="{$gg.num}" {eq name="$gg.num" value="001"} selected {/eq}>{$gg.name || default='暂无'}</option>
                                    {/volist}
                                    {else/}
                                    {volist name="teacher" id="gg"}
                                    <option value="{$gg.num}" {eq name="$msg.teacher_id" value="$gg.num"} selected {/eq}>{$gg.name || default='暂无'}</option>
                                    {/volist}
                                    {/empty}
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-lg-1 text-right control-label">
                                <label>授课学校:</label>
                            </div>
                            <div class="col-lg-11 school">
                                <select name="school" id="type"  class="chosen-select form-control" data-placeholder="--请选择--" multiple>
                                    {empty name="msg"}
                                    <option value="0">点对点总部</option>
                                    {volist name="school" id="gg"}
                                    <option value="{$gg.dx_id}">{$gg.dx|iconv="gbk", "utf-8//ignore", ### || default='暂无'}</option>
                                    {/volist}
                                    {else/}
                                     {volist name="$msg.school_id" id="ss"}
                                    <option value="0" {eq name="$ss" value="0"} selected {/eq}>点对点总部</option>
                                    {volist name="school" id="gg"}
                                    <option value="{$gg.dx_id}" {eq name="$ss" value="$gg.dx_id"} selected {/eq}>{$gg.dx|iconv="gbk", "utf-8//ignore", ###}</option>
                                    {/volist}
                                    {/volist}
                                    {/empty}
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-lg-1 text-right control-label">
                                <label>授课地点:</label>
                            </div>
                            <div class="col-lg-11">
                                <input type="text" placeholder="请输入授课地点" class="form-control form_title" name="address" value="{$msg.address || default=''}">
                            </div>
                        </div>
                        {empty name="msg"}
                        <div class="form-group" id="timeRange">
                            <div class="col-lg-1 text-right control-label">
                                <label>上课时间:</label>
                            </div>
                            <div class="col-lg-11">
                                <div class="date" >
                                    <input type="text" style="width: 40%;float: left;margin-right: 50px" placeholder="请输入开始时间" class="form-control datetimepicker" name="start_time"  value=""/>
                                    <input type="text" style="width: 40%" placeholder="请输入结束时间" class="form-control datetimepicker" name="end_time"  value=""/>
                                </div>
                            </div>
                        </div>
                        {else/}
                        <div class="form-group" id="timeRange">
                            <div class="col-lg-1 text-right control-label">
                                <label>上课时间:</label>
                            </div>
                            <div class="col-lg-11">
                                <div class="date">
                                    <input type="text" style="width: 40%;float: left;margin-right: 50px" placeholder="请输入开始时间" class="form-control datetimepicker " name="start_time"  value="{$msg.start_time|time_format='Y-m-d H:i'}"/>
                                    <input type="text" style="width: 40%" placeholder="请输入结束时间" class="form-control datetimepicker " name="end_time"  value="{$msg.end_time|time_format='Y-m-d H:i'}"/>
                                </div>
                            </div>
                        </div>
                        {/empty}
                        <div class="form-group">
                            <div class="col-lg-1 control-label">
                                <label>授课内容:</label>
                            </div>
                            <div class="col-lg-11">
                                <textarea rows="6" cols="150" name="content">{$msg.content || default=''}</textarea>
                            </div>
                        </div>
                        {empty name="msg"}
                        <div class="form-group">
                            <div class="col-lg-1 text-right control-label">
                                <label>是否领资料:</label>
                            </div>
                            <div class="col-lg-11">
                                <label class="i-checks">
                                    <input type="radio" value="1" name="receive">是
                                </label>
                                <label class="i-checks">
                                    <input type="radio" checked="" value="0" name="receive">否
                                </label>
                            </div>
                        </div>
                        {else/}
                        <div class="form-group">
                            <div class="col-lg-1 text-right control-label">
                                <label>是否领资料:</label>
                            </div>
                            <div class="col-lg-11">
                                <label class="i-checks">
                                    <input type="radio" value="1" name="receive" {eq name="msg.receive" value="1"}checked{/eq}>是
                                </label>
                                <label class="i-checks">
                                    <input type="radio" value="0" name="receive" {eq name="msg.receive" value="0"}checked{/eq}>否
                                </label>
                            </div>
                        </div>
                        {/empty}
                        <input type="hidden" name="id" value="{$msg.id || default=''}">
                        <div class="form-group">
                            <div class="col-lg-11 col-lg-offset-1">
                                {eq name="$is" value="0"}
                                <button class="btn btn-primary submit-btn post-put" type="button" target-form="form-horizontal" >发布</button>
                                {/eq}
                                <a class="btn btn-default" href="javascript:window.history.go(-1);">返回</a>
                            </div>
                        </div>
                        <div class="selblo"></div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{/block}

{block name="script"}
<script src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
<script src="__STATIC__/datepicker/bootstrap-datetimepicker.js"></script>
<script src="__STATIC__/iCheck/icheck.min.js"></script>
<script src="__ADMIN__/js/chosen.jquery.js"></script>
<script>
    $(function(){
        //    单选按钮
        $('.i-checks').iCheck({
            checkboxClass: 'icheckbox_square-green',
            radioClass: 'iradio_square-green'
        });
        highlight_subnav("{:Url('Course/index')}");
        //    时间日历
        $( ".datetimepicker" ).datetimepicker( {
            language:  'cn',
            format: 'yyyy-mm-dd hh:ii',
            minView: "hour",
            forceParse: false,
            todayBtn: true,
            autoclose: true,
            todayHighlight: 1,
            minuteStep: 5

        });
        //多选框
        $(".school select" ).chosen({
            no_results_text: "没有找到该选项",
            allow_single_de: true,
            width:'100%',
            max_selected_options:'10'
        });
        selHeight($('.school select'));
        function selHeight(e){
            e.find('ul').on('click',function(){
                var results = $(this ).next().find('.chosen-results' );
                var h= results.height();
                h=h-100;
                $('.selblo' ).animate({'height':h+'px'},100);
                //切出页面
                var hiddenProperty = 'hidden' in document ? 'hidden' :
                    'webkitHidden' in document ? 'webkitHidden' :
                        null;
                var visibilityChangeEvent = hiddenProperty.replace(/hidden/i, 'visibilitychange');
                var onVisibilityChange = function(){
                    if (!document[hiddenProperty]) {
                        //selgp.find('.search-field').find('input').on('blur');
                    }else{
                        e.find('.search-field').find('input').off('blur');
                    }
                };
                $(document).on(visibilityChangeEvent, onVisibilityChange);
            });
            e.find('.search-field').find('input').on('blur',function(){
                setTimeout(function(){
                    $('.selblo' ).animate({'height':'0'});
                },100)
            });
        }
        //发布
        $(".post-put").off('click').on("click",function(){
            var it=$(this);
            if($("input[name='address']").val() == '' || $("input[name='address']").val() == null){
                updateAlert('请输入授课地点', 'error');
                return;
            }
            if ($("select[name='school']").val() == null || $("select[name='school']").val() == ''){
                updateAlert('请选择授课学校', 'error');
                return;
            }
            if($("input[name='start_time']").val() == '' || $("input[name='start_time']").val() == null){
                updateAlert('请选择开始时间', 'error');
                return;
            }
            if($("input[name='end_time']").val() == '' || $("input[name='end_time']").val() == null){
                updateAlert('请选择结束时间', 'error');
                return;
            }
            if($("input[name='start_time']").val() >= $("input[name='end_time']").val()){
                updateAlert('结束时间不能早于开始时间', 'error');
                return;
            }
            if($("textarea[name='content']").val() == '' || $("textarea[name='content']").val() == null){
                updateAlert('请输入授课内容', 'error');
                return;
            }
            document.getElementsByClassName("post-put").disabled=true;
            var data = {
                id:$("input[name='id']").val(),
                country:$(".country option:selected").text(),
                country_id:$("select[name='country']").val(),
                city:$(".city option:selected").text(),
                city_id:$("select[name='city']").val(),
                place_id:$("select[name='place']").val(),
                place:$(".place option:selected").text(),
                education:$(".education option:selected").text(),
                education_id:$("select[name='education']").val(),
                name:$(".name option:selected").text(),
                name_id:$("select[name='name']").val(),
                project_id:$("select[name='project']").val(),
                class:$("select[name='class']").val(),
                project_name:$('.project option:selected').text(),
                subject:$(".subject option:selected").text(),
                subject_id:$("select[name='subject']").val(),
                stage_id:$("select[name='stage']").val(),
                stage_name:$('.stage option:selected').text(),
                module:$(".module option:selected").text(),
                module_id:$("select[name='module']").val(),
                time:$("select[name='time']").val(),
                time_name:$(".time option:selected").text(),
                teacher:$(".teacher option:selected").text(),
                teacher_id:$("select[name='teacher']").val(),
                school_id:$("select[name='school']").val(),
                address:$("input[name='address']").val(),
                content:$("textarea[name='content']").val(),
                start_time:$("input[name='start_time']").val(),
                end_time:$("input[name='end_time']").val(),
                receive:$("input[name='receive']:checked").val(),
            };
            $.ajax({
                type:"post",
                url:$("#form").attr("action"),
                data:data,
                success:function(data){
                    if(data.code == 1){
                        if (data.url) {
                            updateAlert(data.msg + ' 页面即将自动跳转~','success');
                        }else{
                            updateAlert(data.msg ,'success');
                        }
                        it.prop('disabled','true');
                        it.prev().prop('disabled','true');
                        setTimeout(function(){
                            if (data.url) {
                                location.href=data.url;
                            } else {
                                location.reload();
                            }
                            it.removeAttr('disabled');
                            it.prev().removeAttr('disabled')
                        },2000);
                    } else {
                        updateAlert(data.msg, 'error');
                        it.attr('disabled','true');
                        it.prev().prop('disabled','true');
                        setTimeout(function(){
                            it.removeAttr('disabled');
                            it.prev().removeAttr('disabled')
                        },2000);
                    }
                }
            });
            return false;
        });
    })

</script>
{/block}